home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 3 / ct-rom iiib.zip / ct-rom iiib / WINDOWS / DIVERSEN / WINE02BX / EMACS.2 < prev    next >
Text File  |  1993-03-28  |  49KB  |  1,217 lines

  1. Info file ../info/emacs, produced by Makeinfo, -*- Text -*- from input
  2. file lemacs.tex.
  3.  
  4.    This file documents the GNU Emacs editor.
  5.  
  6.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.  Copyright (C)
  7. 1991, 1992 Lucid, Inc.
  8.  
  9.    Permission is granted to make and distribute verbatim copies of
  10. this manual provided the copyright notice and this permission notice
  11. are preserved on all copies.
  12.  
  13.    Permission is granted to copy and distribute modified versions of
  14. this manual under the conditions for verbatim copying, provided also
  15. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  16. General Public License" are included exactly as in the original, and
  17. provided that the entire resulting derived work is distributed under
  18. the terms of a permission notice identical to this one.
  19.  
  20.    Permission is granted to copy and distribute translations of this
  21. manual into another language, under the above conditions for modified
  22. versions, except that the sections entitled "The GNU Manifesto",
  23. "Distribution" and "GNU General Public License" may be included in a
  24. translation approved by the author instead of in the original English.
  25.  
  26. 
  27. File: emacs,  Node: Character Representation,  Next: Commands,  Prev: Super and Hyper Keys,  Up: Keystrokes
  28.  
  29. Representation of Characters
  30. ============================
  31.  
  32.    This section briefly discusses how characters are represented in
  33. Emacs buffers.  *Note Key Sequences:: for information on representing
  34. key sequences to create key bindings.
  35.  
  36.    ASCII graphic characters in Emacs buffers are displayed with their
  37. graphics.  LFD is the same as a newline character; it is displayed by
  38. starting a new line.  TAB is displayed by moving to the next tab stop
  39. column (usually every 8 spaces).  Other control characters are
  40. displayed as a caret (`^') followed by the non-control version of the
  41. character; thus, `C-a' is displayed as `^A'.  Non-ASCII characters 128
  42. and up are displayed with octal escape sequences; thus, character code
  43. 243 (octal), also called `M-#' when used as an input character, is
  44. displayed as `\243'.
  45.  
  46.    The variable `ctl-arrow' may be used to alter this behavior.  *Note
  47. Display Vars::.
  48.  
  49. 
  50. File: emacs,  Node: Commands,  Next: Pull-down Menus,  Prev: Character Representation,  Up: Top
  51.  
  52. Keys and Commands
  53. =================
  54.  
  55.    This manual is full of passages that tell you what particular keys
  56. do.  But Emacs does not assign meanings to keys directly.  Instead,
  57. Emacs assigns meanings to "functions", and then gives keys their
  58. meanings by "binding" them to functions.
  59.  
  60.    A function is a Lisp object that can be executed as a program. 
  61. Usually it is a Lisp symbol that has been given a function definition;
  62. every symbol has a name, usually made of a few English words separated
  63. by dashes, such as `next-line' or `forward-word'.  It also has a
  64. "definition", which is a Lisp program.  Only some functions can be the
  65. bindings of keys; these are functions whose definitions use
  66. `interactive' to specify how to call them interactively.  Such
  67. functions are called "commands", and their names are "command names". 
  68. More information on this subject will appear in the GNU Emacs Lisp
  69. Manual.
  70.  
  71.    The bindings between keys and functions are recorded in various
  72. tables called "keymaps".  *Note Key Bindings:: for more information on
  73. key sequences you can bind commands to.  *Note Keymaps:: for
  74. information on creating keymaps.
  75.  
  76.    When we say  "`C-n' moves down vertically one line" we are glossing
  77. over a distinction that is irrelevant in ordinary use but is vital in
  78. understanding how to customize Emacs.  The function `next-line' is
  79. programmed to move down vertically.  `C-n' has this effect because it
  80. is bound to that function.  If you rebind `C-n' to the function
  81. `forward-word' then `C-n' will move forward by words instead. 
  82. Rebinding keys is a common method of customization.
  83.  
  84.    The rest of this manual usually ignores this subtlety to keep
  85. things simple.  To give the customizer the information needed, we often
  86. state the name of the command that really does the work in parentheses
  87. after mentioning the key that runs it.  For example, we will say that
  88. "The command `C-n' (`next-line') moves point vertically down," meaning
  89. that `next-line' is a command that moves vertically down and `C-n' is
  90. a key that is standardly bound to it.
  91.  
  92.    While we are on the subject of information for customization only,
  93. it's a good time to tell you about "variables".  Often the description
  94. of a command will say, "To change this, set the variable
  95. `mumble-foo'."  A variable is a name used to remember a value.  Most
  96. of the variables documented in this manual exist just to facilitate
  97. customization: some command or other part of Emacs uses the variable
  98. and behaves differently depending on its setting.  Until you are
  99. interested in customizing, you can ignore the information about
  100. variables.  When you are ready to be interested, read the basic
  101. information on variables, then the information on individual variables
  102. will make sense.  *Note Variables::.
  103.  
  104. 
  105. File: emacs,  Node: Pull-down Menus,  Next: Mouse Selection,  Prev: Commands,  Up: Top
  106.  
  107. Lucid GNU Emacs Pull-down Menus
  108. ===============================
  109.  
  110.    If you are running Lucid GNU Emacs under X, a menu bar on top of the
  111. Emacs screen provides access to pull-down menus of file, edit, and
  112. help-related commands. The menus provide convenient shortcuts and an
  113. easy interface for novice users.  They do not provide additions to the
  114. functionality available via key commands; you can still invoke commands
  115. from the keyboard as in previous versions of Emacs.
  116.  
  117. File
  118.      Perform file and buffer-related operations, such as opening and
  119.      closing files, saving and printing buffers, as well as exiting
  120.      Emacs.
  121.  
  122. Edit
  123.      Perform standard editing operations, such as cutting, copying,
  124.      pasting and killing selected text.
  125.  
  126. Buffers
  127.      Present a menu of buffers for selection as well as the option to
  128.      display a buffer list.
  129.  
  130. Help
  131.      Access to Emacs Info.
  132.  
  133.    There are two ways of selecting an item from a pull-down menu:
  134.  
  135.    * Select an item in the menu bar by moving the cursor over it and
  136.      click the left mouse-button.  Then move the cursor over the item
  137.      you want to choose and click left again.
  138.  
  139.    * Select an item in the menu bar by moving the cursor over it and
  140.      click and hold the left mouse-button.  With the mouse-button
  141.      depressed, move the cursor over the item you want, then release
  142.      it to make your selection.
  143.  
  144.    If a command in the pull-down menu is not applicable in a given
  145. situation, the command is disabled and its name appears faded.  You
  146. cannot invoke items that are faded.  For example, most commands on the
  147. Edit menu appear faded until you select text on which they are to
  148. operate; after you select a block of text, edit commands are enabled. 
  149. *Note Mouse Selection:: for information on using the mouse to select
  150. text.  *Note Using X Selections:: for related information.
  151.  
  152.    There are also `M-x' equivalents for each menu item.  To find the
  153. equivalent for any left-button menu item, do the following:
  154.  
  155.   1. Type `C-h k' to get the `Describe Key' prompt.
  156.  
  157.   2. Select the menu item and click.
  158.  
  159.    Emacs displays the function associated with the menu item in a
  160. separate window, usually together with some documentation.
  161.  
  162. * Menu:
  163.  
  164. * File Menu::           Items on the File menu.
  165. * Edit Menu::           Items on the Edit menu.
  166. * Buffers Menu::        Information about the Buffers menu
  167. * Help Menu::           Items on the Help menu.
  168. * Menu Customization::  Adding and removing menu items and related
  169.                         operations.
  170.  
  171. 
  172. File: emacs,  Node: File Menu,  Next: Edit Menu,  Prev: Pull-down Menus,  Up: Pull-down Menus
  173.  
  174. The File Menu
  175. .............
  176.  
  177.    The File menu bar item contains the items New Screen, Open File...,
  178. Save Buffer, Save Buffer As..., Revert Buffer, Print Buffer, Delete
  179. Screen, Kill Buffer and Exit Emacs on the pull-down menu.  If you
  180. select a menu item, Emacs executes the equivalent command.
  181.  
  182. New Screen
  183.      Creates a new Emacs screen, that is, a new X window running under
  184.      the same Emacs process.  You can remove the screen using the
  185.      Delete Screen menu item. When you remove the last screen, you
  186.      exit Emacs and are prompted for confirmation.  This is bound to
  187.      `C-x 5' by default.
  188.  
  189. Open File...
  190.      Prompts you for a filename and loads that file into a new buffer. 
  191.      Open File... is equivalent to the Emacs command `find-file' (`C-x
  192.      C-f').
  193.  
  194. Save Buffer
  195.      Writes and saves the current Emacs buffer as the latest version
  196.      of the current visited file.  Save Buffer is equivalent to the
  197.      Emacs command `save-buffer' (`C-x C-s').
  198.  
  199. Save Buffer As...
  200.      Writes and saves the current Emacs buffer to the filename you
  201.      specify.  Save Buffer As... is equivalent to the Emacs command
  202.      `write-file' (`C-x C-w').
  203.  
  204. Revert Buffer
  205.      Restores the last saved version of the file to the current
  206.      buffer.  When you edit a buffer containing a text file, you must
  207.      save the buffer before your changes become effective.  Use Revert
  208.      Buffer if you do not want to keep the changes you have made in
  209.      the buffer.  Revert Buffer is equivalent to the Emacs command
  210.      `revert-file' (`M-x revert-buffer').
  211.  
  212. Print Buffer
  213.      Prints a hardcopy of the current buffer.  Equivalent to the Emacs
  214.      command `print-buffer' (`M-x print-buffer').
  215.  
  216. Delete Screen
  217.      Allows you to close all but one of the screens created by New
  218.      Screen.  If you created several Emacs screens belonging to the
  219.      same Emacs process, you can close all but one of them.  When you
  220.      attempt to close the last screen, Emacs informs you that you are
  221.      attempting to delete the last screen.  You have to choose Exit
  222.      Emacs for that.
  223.  
  224. Kill Buffer...
  225.      Prompts you for the name of a buffer to kill. The default is the
  226.      name of the currently selected buffer. Kill Buffer is equivalent
  227.      to the Emacs command `kill-buffer' (`C-x k').
  228.  
  229. Exit Emacs
  230.      Shuts down (kills) the Emacs process.  Equivalent to the Emacs
  231.      command `save-buffers-kill-emacs' (`C-x C-c').  Before killing the
  232.      Emacs process, the system asks which unsaved buffers to save by
  233.      going through the list of all buffers in that Emacs process.
  234.  
  235. 
  236. File: emacs,  Node: Edit Menu,  Next: Buffers Menu,  Prev: File Menu,  Up: Pull-down Menus
  237.  
  238. The Edit Menu
  239. .............
  240.  
  241.    The Edit pull-down menu contains the Undo, Cut, Copy, Paste and
  242. Clear menu items.  When you select a menu item, Emacs executes the
  243. equivalent command.  Most commands on the Edit menu work on a block of
  244. text, the X selection.  They appear faded until you select a block of
  245. text (activate a region) with the mouse.  *Note Using X Selections::,
  246. *note Killing::., and *note Yanking::. for more information.
  247.  
  248. Undo
  249.      Undoes the previous command.  Undo is equivalent to the Emacs
  250.      command `undo' (`C-x u').
  251.  
  252. Cut
  253.      Removes the selected text block from the current buffer, makes it
  254.      the X clipboard selection, and places it in the kill ring. 
  255.      Before executing this command, you have to select a region using
  256.      Emacs region selection commands or with the mouse.
  257.  
  258. Copy
  259.      Makes a selected text block the X clipboard selection, and places
  260.      it in the kill ring.  You can select text using one of the Emacs
  261.      region selection commands or select a text region with the mouse.
  262.  
  263. Paste
  264.      Inserts the current value of the X clipboard selection in the
  265.      current buffer.  Note that this is not necessarily the same as
  266.      the Emacs `yank' command because the Emacs kill ring and the X
  267.      clipboard selection are not the same thing.  You can paste in
  268.      text you have placed in the clipboard using Copy or Cut.  You can
  269.      also use Paste to insert text that was pasted into the clipboard
  270.      from other applications.
  271.  
  272. Clear
  273.      Removes the selected text block from the current buffer but does
  274.      not place it in the kill ring or the X clipboard selection.
  275.  
  276. 
  277. File: emacs,  Node: Buffers Menu,  Next: Help Menu,  Prev: Edit Menu,  Up: Pull-down Menus
  278.  
  279. The Buffers Menu
  280. ................
  281.  
  282.    The Buffers menu provides a selection of up to ten buffers and the
  283. item List All Buffers, which provides a Buffer List. *Note List
  284. Buffers:: for more information.
  285.  
  286. 
  287. File: emacs,  Node: Help Menu,  Next: Menu Customization,  Prev: Buffers Menu,  Up: Pull-down Menus
  288.  
  289. The Help Menu
  290. .............
  291.  
  292.    The Help Menu gives you access to Emacs Info and provides a menu
  293. equivalents for each of the choices you have when using `C-h'.  *Note
  294. Help:: for more information.
  295.  
  296.    The Help menu also gives access to UNIX online manual pages via the
  297. UNIX Manual Page option.
  298.  
  299. 
  300. File: emacs,  Node: Menu Customization,  Prev: Help Menu,  Up: Pull-down Menus
  301.  
  302. Customizing Lucid GNU Emacs Menus
  303. ---------------------------------
  304.  
  305.    You can customize any of the pull-down menus by adding or removing
  306. menu items and disabling or enabling existing menu items.
  307.  
  308.    The following functions are available:
  309.  
  310. `add-menu: (MENU-PATH MENU-NAME MENU-ITEMS &OPTIONAL BEFORE)'
  311.      Add a menu to the menubar or one of its submenus.
  312.  
  313. `add-menu-item: (MENU-PATH ITEM-NAME FUNCTION ENABLED-P &OPTIONAL BEFORE)'
  314.      Add a menu item to a menu, creating the menu first if necessary.
  315.  
  316. `delete-menu-item: (PATH)'
  317.      Remove the menu item defined by PATH from the menu hierarchy.
  318.  
  319. `disable-menu-item: (PATH)'
  320.      Disable the specified menu item.
  321.  
  322. `enable-menu-item: (PATH)'
  323.      Enable the specified previously disabled menu item.
  324.  
  325. `relabel-menu-item: (PATH NEW-NAME)'
  326.      Change the string of the menu item specified by PATH to NEW-NAME.
  327.  
  328.    Use the function `add-menu' to add a new menu or submenu.  If a
  329. menu or submenu of the given name exists already, it is changed.
  330.  
  331.    MENU-PATH identifies the menu under which the new menu should be
  332. inserted.  It is a list of strings; for example, `("File")' names the
  333. top-level File menu.  `("File" "Foo")' names a hypothetical submenu of
  334. File.  If MENU-PATH is `nil', the menu is added to the menubar itself.
  335.  
  336.    MENU-NAME is the string naming the menu to be added.
  337.  
  338.    MENU-ITEMS is a list of menu item descriptions.  Each menu item
  339. should be a vector of three elements:
  340.  
  341.    * A string, which is the name of the menu item.
  342.  
  343.    * A symbol naming a command, or a form to evaluate.
  344.  
  345.    * `t' or `nil' to indicate whether the item is selectable.
  346.  
  347.    The optional argument BEFORE is the name of the menu before which
  348. the new menu or submenu should be added.  If the menu is already
  349. present, it is not moved.
  350.  
  351.    The function `add-menu-item' adds a menu item to the specified
  352. menu, creating the menu first if necessary.  If the named item already
  353. exists, the menu remains unchanged.
  354.  
  355.    MENU-PATH identifies the menu into which the new menu item should
  356. be inserted.  It is a list of strings; for example, `("File")' names
  357. the top-level File menu.  `("File" "Foo")' names a hypothetical
  358. submenu of File.
  359.  
  360.    ITEM-NAME is the string naming the menu item to add.
  361.  
  362.    FUNCTION is the command to invoke when this menu item is selected. 
  363. If it is a symbol, it is invoked with `call-interactively', in the
  364. same way that functions bound to keys are invoked.  If it is a list,
  365. the list is simply evaluated.
  366.  
  367.    ENABLED-P controls whether the item is selectable or not.
  368.  
  369.    For example, to make the `rename-file' command available from the
  370. File menu, use the following code:
  371.  
  372.      (add-menu-item '("File") "Rename File" 'rename-file t)
  373.  
  374.    To add a submenu of file management commands using a File Management
  375. item, use the following code:
  376.  
  377.      (add-menu-item '("File" "File Management") "Copy File" 'copy-file t)
  378.      (add-menu-item '("File" "File Management") "Delete File" 'delete-file t)
  379.      (add-menu-item '("File" "File Management") "Rename File" 'rename-file t)
  380.  
  381.    The optional BEFORE argument is the name of a menu item before
  382. which the new item should be added.  If the item is already present, it
  383. is not moved.
  384.  
  385.    To remove a specified menu item from the menu hierarchy, use
  386. `delete-menu-item'.
  387.  
  388.    PATH is a list of strings that identify the position of the menu
  389. item in the menu hierarchy.  `("File" "Save")' means the menu item
  390. called Save under the top level File menu.  `("Menu" "Foo" "Item")'
  391. means the menu item called Item under the FOO submenu of MENU.
  392.  
  393.    To disable a menu item, use `disable-menu-item'.  The disabled menu
  394. item is grayed and can no longer be selected.  To make the item
  395. selectable again, use `enable-menu-item'.  `disable-menu-item' and
  396. `enable-menu-item' both have the argument PATH.
  397.  
  398.    To change the string of the specified menu item, use
  399. `relabel-menu-item'. This function also takes the argument PATH.
  400.  
  401.    NEW-NAME is the string to which the menu item will be changed.
  402.  
  403. 
  404. File: emacs,  Node: Entering Emacs,  Next: Exiting,  Prev: Mouse Selection,  Up: Top
  405.  
  406. Entering and Exiting Emacs
  407. **************************
  408.  
  409.    The usual way to invoke Emacs is to type `emacs RET' at the shell. 
  410. To invoke Lucid GNU Emacs, type `lemacs RET'.  Emacs clears the screen
  411. and then displays an initial advisory message and copyright notice. 
  412. You can begin typing Emacs commands immediately afterward.
  413.  
  414.    Some operating systems insist on discarding all type-ahead when
  415. Emacs starts up; they give Emacs no way to prevent this.  Therefore,
  416. it is wise to wait until Emacs clears the screen before typing the
  417. first editing command.
  418.  
  419.    Before Emacs reads the first command, you have not had a chance to
  420. give a command to specify a file to edit.  Since Emacs must always
  421. have a current buffer for editing, it presents a buffer, by default, a
  422. buffer named `*scratch*'.  The buffer is in Lisp Interaction mode; you
  423. can use it to type Lisp expressions and evaluate them, or you can
  424. ignore that capability and simply doodle.  You can specify a different
  425. major mode for this buffer by setting the variable
  426. `initial-major-mode' in your init file.  *Note Init File::.
  427.  
  428.    It is possible to give Emacs arguments in the shell command line to
  429. specify files to visit, Lisp files to load, and functions to call.
  430.  
  431. 
  432. File: emacs,  Node: Exiting,  Next: Command Switches,  Prev: Entering Emacs,  Up: Top
  433.  
  434. Exiting Emacs
  435. =============
  436.  
  437.    There are two commands for exiting Emacs because there are two kinds
  438. of exiting: "suspending" Emacs and "killing" Emacs.  "Suspending"
  439. means stopping Emacs temporarily and returning control to its superior
  440. (usually the shell), allowing you to resume editing later in the same
  441. Emacs job, with the same files, same kill ring, same undo history, and
  442. so on.  This is the usual way to exit.  "Killing" Emacs means
  443. destroying the Emacs job.  You can run Emacs again later, but you will
  444. get a fresh Emacs; there is no way to resume the same editing session
  445. after it has been killed.
  446.  
  447. `C-z'
  448.      Suspend Emacs (`suspend-emacs').  If used under the X window
  449.      system, shrink the X window containing the Emacs screen to an
  450.      icon.  (see below)
  451.  
  452. `C-x C-c'
  453.      Kill Emacs (`save-buffers-kill-emacs').
  454.  
  455.    If you use Lucid GNU Emacs under the X window system, `C-z' shrinks
  456. the X window containing the Emacs screen to an icon.  The Emacs process
  457. is stopped temporarily, and control is returned to the window manager. 
  458. If more than one screen is associated with the Emacs process, only the
  459. screen from which you used `C-z' is retained.  The X windows
  460. containing the other Emacs screens are closed.
  461.  
  462.    To activate the "suspended" Emacs, use the appropriate window
  463. manager mouse gestures.  Usually left-clicking on the icon reactivates
  464. and reopens the X window containing the Emacs screen, but the window
  465. manager you use determines what exactly happens.  To actually kill the
  466. Emacs process, use `C-x C-c' or the Exit Emacs item on the File menu.
  467.  
  468.    On systems that do not permit programs to be suspended, `C-z' runs
  469. an inferior shell that communicates directly with the terminal, and
  470. Emacs waits until you exit the subshell.  On these systems, the only
  471. way to return to the shell from which Emacs was started (to log out,
  472. for example) is to kill Emacs.  `C-d' or `exit' are typical commands
  473. to exit a subshell.
  474.  
  475.    To kill Emacs, type `C-x C-c' (`save-buffers-kill-emacs').  A
  476. two-character key is used for this to make it harder to type.  In Lucid
  477. GNU Emacs, selecting the Exit Emacs option of the File menu is an
  478. alternate way of issuing the command.
  479.  
  480.    Unless a numeric argument is used, this command first offers to
  481. save any modified buffers.  If you do not save all buffers, you are
  482. asked for reconfirmation with `yes' before killing Emacs, since any
  483. changes not saved will be lost.  If any subprocesses are still
  484. running, `C-x C-c' asks you to confirm killing them, since killing
  485. Emacs kills the subprocesses simultaneously.
  486.  
  487.    In most programs running on Unix, certain characters may instantly
  488. suspend or kill the program.  (In Berkeley Unix these characters are
  489. normally `C-z' and `C-c'.)  This Unix feature is turned off while you
  490. are in Emacs. The meanings of `C-z' and `C-x C-c' as keys in Emacs
  491. were inspired by the standard Berkeley Unix meanings of `C-z' and
  492. `C-c', but that is their only relationship with Unix.  You could
  493. customize these keys to do anything (*note Keymaps::.).
  494.  
  495. 
  496. File: emacs,  Node: Command Switches,  Next: Basic,  Prev: Exiting,  Up: Top
  497.  
  498. Command Line Switches and Arguments
  499. ===================================
  500.  
  501.    GNU Emacs supports command line arguments you can use to request
  502. various actions when invoking Emacs.  The commands are for
  503. compatibility with other editors and for sophisticated activities.  If
  504. you are using Lucid GNU Emacs under the X window system, you can also
  505. use a number of standard Xt command line arguments. Command line
  506. arguments are not usually needed for editing with Emacs; new users can
  507. skip this section.
  508.  
  509.    Many editors are designed to be started afresh each time you want to
  510. edit.  You start the editor to edit one file; then exit the editor. 
  511. The next time you want to edit either another file or the same one, you
  512. start the editor again.  Under these circumstances, it makes sense to
  513. use a command line argument to say which file to edit.
  514.  
  515.    The recommended way to use GNU Emacs is to start it only once, just
  516. after you log in, and do all your editing in the same Emacs process. 
  517. Each time you want to edit a file, you visit it using the existing
  518. Emacs.  Emacs creates a new buffer for each file and (unless you kill
  519. some of the buffers), Emacs eventually has many files in it ready for
  520. editing.  Usually you do not kill the Emacs process until you are about
  521. to log out.  Since you usually read files by typing commands to Emacs,
  522. command line arguments for specifying a file Emacs is started are
  523. seldom needed.
  524.  
  525.    Emacs accepts command-line arguments that specify files to visit,
  526. functions to call, and other activities and operating modes.  If you
  527. are running Lucid GNU Emacs under the X window system, a number of
  528. standard Xt command line arguments are available as well.
  529.  
  530.    The following sections list:
  531.  
  532.    * Command line arguments that you can always use.
  533.  
  534.    * Command line arguments that have to appear at the beginning of the
  535.      argument list.
  536.  
  537.    * Command line arguments that are only relevant if you are running
  538.      Lucid GNU Emacs under X.
  539.  
  540.    Command line arguments are processed in the order they appear on the
  541. command line; however, certain arguments (the ones in the second
  542. table) must be at the front of the list if they are used.
  543.  
  544.    Here are the arguments allowed:
  545.  
  546. `FILE'
  547.      Visit FILE using `find-file'.  *Note Visiting::.
  548.  
  549. `+LINENUM FILE'
  550.      Visit FILE using `find-file', then go to line number LINENUM in
  551.      it.
  552.  
  553. `-l FILE'
  554. `-load FILE'
  555.      Load a file FILE of Lisp code with the function `load'.  *Note
  556.      Lisp Libraries::.
  557.  
  558. `-f FUNCTION'
  559. `-funcall FUNCTION'
  560.      Call Lisp function FUNCTION with no arguments.
  561.  
  562. `-i FILE'
  563. `-insert FILE'
  564.      Insert the contents of FILE into the current buffer.  This is like
  565.      what `M-x insert-buffer' does; *Note Misc File Ops::.
  566.  
  567. `-kill'
  568.      Exit from Emacs without asking for confirmation.
  569.  
  570. `-version'
  571.      Prints version information.  This implies `-batch'.
  572.  
  573.           % emacs -version
  574.           GNU Emacs 19.4 Lucid of Mon Dec 28 1992 on thalidomide (berkeley-unix)
  575.  
  576. `-help'
  577.      Prints a summary of command-line options, and exits.
  578.  
  579.    The following arguments are recognized only at the beginning of the
  580. command line.  If more than one of them appears, they must appear in
  581. the order in which they appear in this table.
  582.  
  583. `-t FILE'
  584.      Use FILE instead of the terminal for input and output. (This
  585.      option is currently not valid in Lucid GNU Emacs)
  586.  
  587. `-batch'
  588.      Run Emacs in "batch mode", which means that the text being edited
  589.      is not displayed and the standard Unix interrupt characters such
  590.      as `C-z' and `C-c' continue to have their normal effect.  Emacs in
  591.      batch mode outputs to `stderr' only what would normally be printed
  592.      in the echo area under program control.
  593.  
  594.      Batch mode is used for running programs written in Emacs Lisp
  595.      from shell scripts, makefiles, and so on.  Normally the `-l'
  596.      switch or `-f' switch will be used as well, to invoke a Lisp
  597.      program to do the batch processing.
  598.  
  599.      `-batch' implies `-q' (do not load an init file).  It also causes
  600.      Emacs to kill itself after all command switches have been
  601.      processed.  In addition, auto-saving is not done except in
  602.      buffers for which it has been explicitly requested.
  603.  
  604. `-q'
  605. `-no-init-file'
  606.      Do not load your Emacs init file `~/.emacs'.
  607.  
  608. `-u USER'
  609. `-user USER'
  610.      Load USER's Emacs init file `~USER/.emacs' instead of your own.
  611.  
  612.    Note that the init file can get access to the command line argument
  613. values as the elements of a list in the variable `command-line-args'. 
  614. (The arguments in the second table above will already have been
  615. processed and will not be in the list.)  The init file can override
  616. the normal processing of the other arguments by setting this variable.
  617.  
  618.    One way to use command switches is to visit many files
  619. automatically:
  620.  
  621.      emacs *.c
  622.  
  623. passes each `.c' file as a separate argument to Emacs, so that Emacs
  624. visits each file (*note Visiting::.).
  625.  
  626.    Here is an advanced example that assumes you have a Lisp program
  627. file called `hack-c-program.el' which, when loaded, performs some
  628. useful operation on the current buffer, expected to be a C program.
  629.  
  630.      emacs -batch foo.c -l hack-c-program -f save-buffer -kill > log
  631.  
  632. Here Emacs is told to visit `foo.c', load `hack-c-program.el' (which
  633. makes changes in the visited file), save `foo.c' (note that
  634. `save-buffer' is the function that `C-x C-s' is bound to), and then
  635. exit to the shell from which the command was executed.  `-batch'
  636. guarantees there will be no problem redirecting output to `log',
  637. because Emacs will not assume that it has a display terminal to work
  638. with.
  639.  
  640.    If you are running Lucid GNU Emacs under X, a number of options are
  641. available to control color, border, and window title and icon name:
  642.  
  643. `-T TITLE'
  644. `-wn TITLE'
  645.      Use TITLE as the window title. This sets the
  646.      `screen-title-format' variable, which controls the title of the X
  647.      window corresponding to the selected screen.  This is the same
  648.      format as `mode-line-format'.
  649.  
  650. `-in TITLE'
  651. `-iconname TITLE'
  652.      Use TITLE as the icon name. This sets the
  653.      `screen-icon-title-format' variable, which controls the title of
  654.      the icon corresponding to the selected screen.
  655.  
  656. `-mc COLOR'
  657.      Use COLOR as the mouse color.
  658.  
  659. `-cr COLOR'
  660.      Use COLOR as the text-cursor foreground color.
  661.  
  662.    In addition, Lucid GNU Emacs allows you to use a number of standard
  663. Xt command line arguments.
  664.  
  665. `-bg COLOR'
  666. `-background COLOR'
  667.      Use COLOR as the background color.
  668.  
  669. `-bd COLOR'
  670. `-bordercolor COLOR'
  671.      Use COLOR as the border color.
  672.  
  673. `-bw WIDTH'
  674. `-borderwidth WIDTH'
  675.      Use WIDTH as the border width.
  676.  
  677. `-d DISPLAY'
  678. `-display DISPLAY'
  679. `-d DISPLAY'
  680.      When running under the X window system, create the window
  681.      containing the Emacs screen on the display named DISPLAY.
  682.  
  683. `-fg COLOR'
  684. `-foreground COLOR'
  685.      Use COLOR as the foreground color.
  686.  
  687. `-fn NAME'
  688. `-font NAME'
  689.      Use NAME as the font.
  690.  
  691. `-g SPEC'
  692. `-geom SPEC'
  693. `-geometry SPEC'
  694.      Use the geometry specified by SPEC.
  695.  
  696. `- iconic'
  697.      Start up iconified.
  698.  
  699. `-r'
  700. `-reverse'
  701.      Bring up Emacs in reverse video.
  702.  
  703. `-name'
  704.      Use the resource manager specified by NAME.
  705.  
  706. `-xrm'
  707.      Read something into the resource database for this invocation of
  708.      Emacs.
  709.  
  710. `-title TITLE'
  711.      Same as `-wn', sets the window title using `window-title-format'.
  712.  
  713. 
  714. File: emacs,  Node: Basic,  Next: Undo,  Prev: Command Switches,  Up: Top
  715.  
  716. Basic Editing Commands
  717. **********************
  718.  
  719.    We now give the basics of how to enter text, make corrections, and
  720. save the text in a file.  If this material is new to you, you might
  721. learn it more easily by running the Emacs learn-by-doing tutorial.  To
  722. do this, type `Control-h t' (`help-with-tutorial').
  723.  
  724. Inserting Text
  725. ==============
  726.  
  727.    To insert printing characters into the text you are editing, just
  728. type them.  This inserts the characters into the buffer at the cursor
  729. (that is, at "point"; *note Point::.).  The cursor moves forward.  Any
  730. characters after the cursor move forward too.  If the text in the
  731. buffer is `FOOBAR', with the cursor before the `B' and you type `XX',
  732. the result is `FOOXXBAR', with the cursor still before the `B'.
  733.  
  734.    To "delete" text you have just inserted, use DEL.  DEL deletes the
  735. character BEFORE the cursor (not the one that the cursor is on top of
  736. or under; that is the character AFTER the cursor).  The cursor and all
  737. characters after it move backwards.  Therefore, if you type a printing
  738. character and then type DEL, they cancel out.
  739.  
  740.    To end a line and start typing a new one, type RET.  This inserts a
  741. newline character in the buffer.  If point is in the middle of a line,
  742. RET splits the line.  Typing DEL when the cursor is at the beginning
  743. of a line rubs out the newline before the line, thus joining the line
  744. with the preceding line.
  745.  
  746.    Emacs automatically splits lines when they become too long, if you
  747. turn on a special mode called "Auto Fill" mode.  *Note Filling::, for
  748. information on using Auto Fill mode.
  749.  
  750.    Customization information: DEL, in most modes, runs the command
  751. `delete-backward-char'; RET runs the command `newline', and
  752. self-inserting printing characters run the command `self-insert',
  753. which inserts whatever character was typed to invoke it.  Some major
  754. modes rebind DEL to other commands.
  755.  
  756.    Direct insertion works for printing characters and SPC, but other
  757. characters act as editing commands and do not insert themselves.  If
  758. you need to insert a control character or a character whose code is
  759. above 200 octal, you must "quote" it by typing the character
  760. `control-q' (`quoted-insert') first.  There are two ways to use `C-q':
  761.  
  762.    * `Control-q' followed by any non-graphic character (even `C-g')
  763.      inserts that character.
  764.  
  765.    * `Control-q' followed by three octal digits inserts the character
  766.      with the specified character code.
  767.  
  768. A numeric argument to `C-q' specifies how many copies of the quoted
  769. character should be inserted (*note Arguments::.).
  770.  
  771.    If you prefer to have text characters replace (overwrite) existing
  772. text instead of moving it to the right, you can enable Overwrite mode,
  773. a minor mode.  *Note Minor Modes::.
  774.  
  775. Changing the Location of Point
  776. ==============================
  777.  
  778.    To do more than insert characters, you have to know how to move
  779. point (*note Point::.).  Here are a few of the available commands.
  780.  
  781. `C-a'
  782.      Move to the beginning of the line (`beginning-of-line').
  783.  
  784. `C-e'
  785.      Move to the end of the line (`end-of-line').
  786.  
  787. `C-f'
  788.      Move forward one character (`forward-char').
  789.  
  790. `C-b'
  791.      Move backward one character (`backward-char').
  792.  
  793. `M-f'
  794.      Move forward one word (`forward-word').
  795.  
  796. `M-b'
  797.      Move backward one word (`backward-word').
  798.  
  799. `C-n'
  800.      Move down one line, vertically (`next-line').  This command
  801.      attempts to keep the horizontal position unchanged, so if you
  802.      start in the middle of one line, you end in the middle of the
  803.      next.  When on the last line of text, `C-n' creates a new line
  804.      and moves onto it.
  805.  
  806. `C-p'
  807.      Move up one line, vertically (`previous-line').
  808.  
  809. `C-l'
  810.      Clear the screen and reprint everything (`recenter').  Text moves
  811.      on the screen to bring point to the center of the window.
  812.  
  813. `M-r'
  814.      Move point to left margin on the line halfway down the screen or
  815.      window (`move-to-window-line').  Text does not move on the
  816.      screen.  A numeric argument says how many screen lines down from
  817.      the top of the window (zero for the top).  A negative argument
  818.      counts from the bottom (-1 for the bottom).
  819.  
  820. `C-t'
  821.      Transpose two characters, the ones before and after the cursor 
  822.      (`transpose-chars').
  823.  
  824. `M-<'
  825.      Move to the top of the buffer (`beginning-of-buffer').  With
  826.      numeric argument N, move to N/10 of the way from the top.  *Note
  827.      Arguments::, for more information on numeric arguments.
  828.  
  829. `M->'
  830.      Move to the end of the buffer (`end-of-buffer').
  831.  
  832. `M-x goto-char'
  833.      Read a number N and move the cursor to character number N. 
  834.      Position 1 is the beginning of the buffer.
  835.  
  836. `M-x goto-line'
  837.      Read a number N and move cursor to line number N.  Line 1 is the
  838.      beginning of the buffer.
  839.  
  840. `C-x C-n'
  841.      Use the current column of point as the "semi-permanent goal
  842.      column" for `C-n' and `C-p' (`set-goal-column').  Henceforth,
  843.      those commands always move to this column in each line moved
  844.      into, or as close as possible given the contents of the line. 
  845.      This goal column remains in effect until canceled.
  846.  
  847. `C-u C-x C-n'
  848.      Cancel the goal column.  Henceforth, `C-n' and `C-p' once again
  849.      try to avoid changing the horizontal position, as usual.
  850.  
  851.    If you set the variable `track-eol' to a non-`nil' value, `C-n' and
  852. `C-p' move to the end of the line when at the end of the starting
  853. line.  By default, `track-eol' is `nil'.
  854.  
  855. Erasing Text
  856. ============
  857.  
  858. `DEL'
  859.      Delete the character before the cursor (`delete-backward-char').
  860.  
  861. `C-d'
  862.      Delete the character after the cursor (`delete-char').
  863.  
  864. `C-k'
  865.      Kill to the end of the line (`kill-line').
  866.  
  867. `M-d'
  868.      Kill forward to the end of the next word (`kill-word').
  869.  
  870. `M-DEL'
  871.      Kill back to the beginning of the previous word
  872.      (`backward-kill-word').
  873.  
  874.    In contrast to the DEL key, which deletes the character before the
  875. cursor, `Control-d' deletes the character after the cursor, causing
  876. the rest of the text on the line to shift left.  If `Control-d' is
  877. typed at the end of a line, that line and the next line are joined.
  878.  
  879.    To erase a larger amount of text, use `Control-k', which kills a
  880. line at a time.  If you use `C-k' at the beginning or in the middle of
  881. a line, it kills all the text up to the end of the line.  If you use
  882. `C-k' at the end of a line, it joins that line and the next line.
  883.  
  884.    *Note Killing::, for more flexible ways of killing text.
  885.  
  886. Files
  887. =====
  888.  
  889.    The commands above are sufficient for creating and altering text in
  890. an Emacs buffer.  More advanced Emacs commands just make things
  891. easier.  But to keep any text permanently you must put it in a "file".
  892.  Files are named units of text which are stored by the operating
  893. system and which you can retrieve by name.  To look at or use the
  894. contents of a file in any way, including editing the file with Emacs,
  895. you must specify the file name.
  896.  
  897.    Consider a file named `/usr/rms/foo.c'.  To begin editing this file
  898. from Emacs, type
  899.  
  900.      C-x C-f /usr/rms/foo.c RET
  901.  
  902. The file name is given as an "argument" to the command `C-x C-f'
  903. (`find-file').  The command uses the "minibuffer" to read the
  904. argument.  You have to type RET to terminate the argument (*note
  905. Minibuffer::.).
  906.  
  907.    You can also use the Open File... menu item from the File menu, then
  908. type the name of the file to the prompt.
  909.  
  910.    Emacs obeys the command by "visiting" the file: it creates a
  911. buffer, copies the contents of the file into the buffer, and then
  912. displays the buffer for you to edit.  You can make changes in the
  913. buffer, and then "save" the file by typing `C-x C-s' (`save-buffer')
  914. or choosing Save Buffer from the File menu.  This makes the changes
  915. permanent by copying the altered contents of the buffer back into the
  916. file `/usr/rms/foo.c'.  Until then, the changes are only inside your
  917. Emacs buffer, and the file `foo.c' is not changed.
  918.  
  919.    To create a file, visit the file with `C-x C-f' as if it already
  920. existed or choose Open File from the File menu and provide the name
  921. for the new file in the minibuffer.  Emacs will create an empty buffer
  922. in which you can insert the text you want to put in the file.  When
  923. you save the buffer with `C-x C-s', or by choosing Save Buffer from
  924. the File menu, the file is created.
  925.  
  926.    To learn more about using files, *note Files::..
  927.  
  928. Help
  929. ====
  930.  
  931.    If you forget what a key does, you can use the Help character,
  932. `C-h' to find out: Type `C-h k' followed by the key you want to know
  933. about.  For example, `C-h k C-n' tells you what `C-n' does.  `C-h' is
  934. a prefix key; `C-h k' is just one of its subcommands (the command
  935. `describe-key').  The other subcommands of `C-h' provide different
  936. kinds of help.  Type `C-h' three times to get a description of all the
  937. help facilities.  *Note Help::.
  938.  
  939. * Menu:
  940.  
  941. * Blank Lines::        Commands to make or delete blank lines.
  942. * Continuation Lines:: Lines too wide for the screen.
  943. * Position Info::      What page, line, row, or column is point on?
  944. * Arguments::           Numeric arguments for repeating a command.
  945.  
  946. 
  947. File: emacs,  Node: Blank Lines,  Next: Continuation Lines,  Prev: Basic,  Up: Basic
  948.  
  949. Blank Lines
  950. ===========
  951.  
  952.    Here are special commands and techniques for entering and removing
  953. blank lines.
  954.  
  955. `C-o'
  956.      Insert one or more blank lines after the cursor (`open-line').
  957.  
  958. `C-x C-o'
  959.      Delete all but one of many consecutive blank lines
  960.      (`delete-blank-lines').
  961.  
  962.    When you want to insert a new line of text before an existing line,
  963. you just type the new line of text, followed by RET.  If you prefer to
  964. first create a blank line and then insert the desired text, use the
  965. key `C-o' (`open-line'), which inserts a newline after point but
  966. leaves point in front of the newline.  Then type the text into the new
  967. line.  `C-o F O O' has the same effect as `F O O RET', except for the
  968. final location of point.
  969.  
  970.    To create several blank lines, type `C-o' several times, or give
  971. `C-o' an argument indicating how many blank lines to create.  *Note
  972. Arguments::, for more information.
  973.  
  974.    If you have many blank lines in a row and want to get rid of them,
  975. use `C-x C-o' (`delete-blank-lines').  If point is on a blank line
  976. which is adjacent to at least one other blank line, `C-x C-o' deletes
  977. all but one of the blank lines.  If point is on a blank line with no
  978. other adjacent blank line, the sole blank line is deleted.  If point
  979. is on a non-blank line, `C-x C-o' deletes any blank lines following
  980. that non-blank line.
  981.  
  982. 
  983. File: emacs,  Node: Continuation Lines,  Next: Position Info,  Prev: Blank Lines,  Up: Basic
  984.  
  985. Continuation Lines
  986. ==================
  987.  
  988.    If you add too many characters to one line without breaking with a
  989. RET, the line grows to occupy two (or more) screen lines, with a
  990. curved arrow at the extreme right margin of all but the last line.  The
  991. curved arrow indicates that the following screen line is not really a
  992. distinct line in the text, but just the "continuation" of a line too
  993. long to fit the screen.  You can use Auto Fill mode, (*note
  994. Filling::.), to have Emacs insert newlines automatically when a line
  995. gets too long.
  996.  
  997.    Instead of continuation, long lines can be displayed by
  998. "truncation".  This means that all the characters that do not fit in
  999. the width of the screen or window do not appear at all.  They remain
  1000. in the buffer, temporarily invisible.  Three diagonal dots in the last
  1001. column (instead of the curved arrow inform you that truncation is in
  1002. effect.
  1003.  
  1004.    To turn off continuation for a particular buffer set the variable
  1005. `truncate-lines' to non-`nil' in that buffer.  Truncation instead of
  1006. continuation also happens whenever horizontal scrolling is in use, and
  1007. optionally whenever side-by-side windows are in use (*note
  1008. Windows::.).  Altering the value of `truncate-lines' makes it local to
  1009. the current buffer; until that time, the default value is in effect. 
  1010. The default is initially `nil'.  *Note Locals::.
  1011.  
  1012. 
  1013. File: emacs,  Node: Position Info,  Next: Arguments,  Prev: Continuation Lines,  Up: Basic
  1014.  
  1015. Cursor Position Information
  1016. ===========================
  1017.  
  1018.    If you are accustomed to other display editors, you may be surprised
  1019. that Emacs does not always display the page number or line number of
  1020. point in the mode line.  In Emacs, this information is only rarely
  1021. needed, and a number of commands are available to compute and print it. 
  1022. Since text is stored in a way that makes it difficult to compute the
  1023. information, it is not displayed all the time.
  1024.  
  1025. `M-x what-page'
  1026.      Print page number of point, and line number within page.
  1027.  
  1028. `M-x what-line'
  1029.      Print line number of point in the buffer.
  1030.  
  1031. `M-='
  1032.      Print number of lines in the current region
  1033.      (`count-lines-region').
  1034.  
  1035. `C-x ='
  1036.      Print character code of character after point, character position
  1037.      of point, and column of point (`what-cursor-position').
  1038.  
  1039.    There are several commands for printing line numbers:
  1040.  
  1041.    * `M-x what-line' counts lines from the beginning of the file and
  1042.      prints the line number point is on.  The first line of the file
  1043.      is line number 1.  You can use these numbers as arguments to `M-x
  1044.      goto-line'.
  1045.  
  1046.    * `M-x what-page' counts pages from the beginning of the file, and
  1047.      counts lines within the page, printing both of them.  *Note
  1048.      Pages::, for the command `C-x l' which counts the lines in the
  1049.      current page.
  1050.  
  1051.    * `M-=' (`count-lines-region'), prints the number of lines in the
  1052.      region (*note Mark::.).
  1053.  
  1054.    The command `C-x =' (`what-cursor-position') provides information
  1055. about point and about the column the cursor is in.  It prints a line
  1056. in the echo area that looks like this:
  1057.  
  1058.      Char: x (0170)  point=65986 of 563027(12%)  x=44
  1059.  
  1060. (In fact, this is the output produced when point is before the `x=44'
  1061. in the example.)
  1062.  
  1063.    The two values after `Char:' describe the character following point,
  1064. first by showing it and second by giving its octal character code.
  1065.  
  1066.    `point=' is followed by the position of point expressed as a
  1067. character count.  The front of the buffer counts as position 1, one
  1068. character later as 2, and so on.  The next, larger number is the total
  1069. number of characters in the buffer.  Afterward in parentheses comes
  1070. the position expressed as a percentage of the total size.
  1071.  
  1072.    `x=' is followed by the horizontal position of point, in columns
  1073. from the left edge of the window.
  1074.  
  1075.    If the buffer has been narrowed, making some of the text at the
  1076. beginning and the end temporarily invisible, `C-x =' prints additional
  1077. text describing the current visible range.  For example, it might say
  1078.  
  1079.      Char: x (0170)  point=65986 of 563025(12%) <65102 - 68533>  x=44
  1080.  
  1081. where the two extra numbers give the smallest and largest character
  1082. position that point is allowed to assume.  The characters between
  1083. those two positions are the visible ones.  *Note Narrowing::.
  1084.  
  1085.    If point is at the end of the buffer (or the end of the visible
  1086. part), `C-x =' omits any description of the character after point. 
  1087. The output looks like
  1088.  
  1089.      point=563026 of 563025(100%)  x=0
  1090.  
  1091. 
  1092. File: emacs,  Node: Arguments,  Prev: Position Info,  Up: Basic
  1093.  
  1094. Numeric Arguments
  1095. =================
  1096.  
  1097.    Any Emacs command can be given a "numeric argument".  Some commands
  1098. interpret the argument as a repetition count.  For example, giving an
  1099. argument of ten to the key `C-f' (the command `forward-char', move
  1100. forward one character) moves forward ten characters.  With these
  1101. commands, no argument is equivalent to an argument of one.  Negative
  1102. arguments are allowed.  Often they tell a command to move or act
  1103. backwards.
  1104.  
  1105.    If your keyboard has a META key, the easiest way to specify a
  1106. numeric argument is to type digits and/or a minus sign while holding
  1107. down the the META key.  For example,
  1108.  
  1109.      M-5 C-n
  1110.  
  1111. moves down five lines.  The characters `Meta-1', `Meta-2', and so on,
  1112. as well as `Meta--', do this because they are keys bound to commands
  1113. (`digit-argument' and `negative-argument') that are defined to
  1114. contribute to an argument for the next command.
  1115.  
  1116.    Another way of specifying an argument is to use the `C-u'
  1117. (`universal-argument') command followed by the digits of the argument. 
  1118. With `C-u', you can type the argument digits without holding down
  1119. shift keys.  To type a negative argument, start with a minus sign. 
  1120. Just a minus sign normally means -1.  `C-u' works on all terminals.
  1121.  
  1122.    `C-u' followed by a character which is neither a digit nor a minus
  1123. sign has the special meaning of "multiply by four".  It multiplies the
  1124. argument for the next command by four.  `C-u' twice multiplies it by
  1125. sixteen.  Thus, `C-u C-u C-f' moves forward sixteen characters.  This
  1126. is a good way to move forward "fast", since it moves about 1/5 of a
  1127. line in the usual size screen.  Other useful combinations are `C-u
  1128. C-n', `C-u C-u C-n' (move down a good fraction of a screen), `C-u C-u
  1129. C-o' (make "a lot" of blank lines), and `C-u C-k' (kill four lines).
  1130.  
  1131.    Some commands care only about whether there is an argument, and not
  1132. about its value.  For example, the command `M-q' (`fill-paragraph')
  1133. with no argument fills text; with an argument, it justifies the text
  1134. as well.  (*Note Filling::, for more information on `M-q'.)  Just
  1135. `C-u' is a handy way of providing an argument for such commands.
  1136.  
  1137.    Some commands use the value of the argument as a repeat count, but
  1138. do something peculiar when there is no argument.  For example, the
  1139. command `C-k' (`kill-line') with argument N kills N lines, including
  1140. their terminating newlines.  But `C-k' with no argument is special: it
  1141. kills the text up to the next newline, or, if point is right at the
  1142. end of the line, it kills the newline itself.  Thus, two `C-k'
  1143. commands with no arguments can kill a non-blank line, just like `C-k'
  1144. with an argument of one.  (*Note Killing::, for more information on
  1145. `C-k'.)
  1146.  
  1147.    A few commands treat a plain `C-u' differently from an ordinary
  1148. argument.  A few others may treat an argument of just a minus sign
  1149. differently from an argument of -1.  These unusual cases will be
  1150. described when they come up; they are always for reasons of convenience
  1151. of use of the individual command.
  1152.  
  1153. 
  1154. File: emacs,  Node: Undo,  Next: Minibuffer,  Prev: Basic,  Up: Top
  1155.  
  1156. Undoing Changes
  1157. ***************
  1158.  
  1159.    Emacs allows you to undo all changes you make to the text of a
  1160. buffer, up to a certain amount of change (8000 characters).  Each
  1161. buffer records changes individually, and the undo command always
  1162. applies to the current buffer.  Usually each editing command makes a
  1163. separate entry in the undo records, but some commands such as
  1164. `query-replace' make many entries, and very simple commands such as
  1165. self-inserting characters are often grouped to make undoing less
  1166. tedious.
  1167.  
  1168. `C-x u'
  1169.      Undo one batch of changes (usually, one command worth) (`undo').
  1170.  
  1171. `C-_'
  1172.      The same.
  1173.  
  1174.    The command `C-x u' or `C-_' allows you to undo changes.  The first
  1175. time you give this command, it undoes the last change.  Point moves to
  1176. the text affected by the undo, so you can see what was undone.
  1177.  
  1178.    Consecutive repetitions of the `C-_' or `C-x u' commands undo
  1179. earlier and earlier changes, back to the limit of what has been
  1180. recorded.  If all recorded changes have already been undone, the undo
  1181. command prints an error message and does nothing.
  1182.  
  1183.    Any command other than an undo command breaks the sequence of undo
  1184. commands.  Starting at this moment, the previous undo commands are
  1185. considered ordinary changes that can themselves be undone.  Thus, you
  1186. can redo changes you have undone by typing `C-f' or any other command
  1187. that have no important effect, and then using more undo commands.
  1188.  
  1189.    If you notice that a buffer has been modified accidentally, the
  1190. easiest way to recover is to type `C-_' repeatedly until the stars
  1191. disappear from the front of the mode line.  When that happens, all the
  1192. modifications you made have been cancelled.  If you do not remember
  1193. whether you changed the buffer deliberately, type `C-_' once. When you
  1194. see Emacs undo the last change you made, you probably remember why you
  1195. made it.  If the change was an accident, leave it undone.  If it was
  1196. deliberate, redo the change as described in the preceding paragraph.
  1197.  
  1198.    Whenever an undo command makes the stars disappear from the mode
  1199. line, the buffer contents is the same as it was when the file was last
  1200. read in or saved.
  1201.  
  1202.    Not all buffers record undo information.  Buffers whose names start
  1203. with spaces don't; these buffers are used internally by Emacs and its
  1204. extensions to hold text that users don't normally look at or edit. 
  1205. Minibuffers, help buffers and documentation buffers also don't record
  1206. undo information.
  1207.  
  1208.    Emacs can remember at most 8000 or so characters of deleted or
  1209. modified text in any one buffer for reinsertion by the undo command. 
  1210. There is also a limit on the number of individual insert, delete or
  1211. change actions that Emacs can remembered.
  1212.  
  1213.    There are two keys to run the `undo' command, `C-x u' and `C-_',
  1214. because on some keyboards, it is not obvious how to type `C-_'. `C-x
  1215. u' is an alternative you can type in the same fashion on any terminal.
  1216.  
  1217.